<?php
// 登录页
header("content-type:text/html;charset=utf-8");
$ID = $_POST['userID'];
$pwd = $_POST['userPassword'];
include_once("conn.php");

$sql = "SELECT * FROM user_infos WHERE user_ID = '" . $ID . "'";
$result = mysqli_query($connect_DB, $sql);
$rows = mysqli_num_rows($result);
if ($rows != 0) {
    $user_Info = mysqli_fetch_object($result);
    if ($pwd === $user_Info->user_Password) {
        session_start();
        $_SESSION['user_info'] = $user_Info;
        echo "<script>alert('登录成功！');location='user_index.php';</script>";
    } else echo "<script>alert('密码错误！请重试！');history.go(-1);</script>";
}else{
        echo "<script>alert('账号不存在！');history.go(-1);</script>";
}

$connect_DB->close();

?>
